package com.bzm.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @Description:Swagger配置
 * @author hm
 * @time:2020年9月4日 上午10:24:10
 */
@Configuration
//@EnableSwagger2
public class SwaggerConfig {

	@Bean
	public Docket createRestApi() {
		return new Docket(DocumentationType.SWAGGER_2)
				.apiInfo(apiInfo())
				.pathMapping("/")
				.select() // 选择那些路径和api会生成document
				.apis(RequestHandlerSelectors.any())// 对所有api进行监控
				.apis(RequestHandlerSelectors.basePackage("com.bzm.dubbo.test.controller"))
				.build();
	}

	private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
        		.title("八爪猫saass")
        		.description("swagger-ui-生成的接口文档")
        		//.contact(new Contact("name", "url", "email"))
                //.termsOfServiceUrl("无服务条款")
                //.license("The Apache License, Version 2.0")
                //.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
                .version("1.0.0")
                .build();
    }

}
